package com.duoketech.interceptor;

import com.duoketech.model.cart.Cart;
import com.duoketech.service.weixin.cart.WxCartService;
import com.duoketech.utils.DbUtil;
import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import com.jfinal.core.Controller;

import java.util.List;

public class WxCartInterceptor implements Interceptor {
    @Override
    public void intercept(Invocation invocation) {
        Controller c = invocation.getController();
        int memberId = c.getCookieToInt("memberId",0);
        List<Cart> cartItem = WxCartService.ME.queryCartItemOfMine(memberId);
        c.setAttr("cartItem",cartItem);
        invocation.invoke();
    }
}
